
var data1 = [
  {
    id: 1,
    field1: '2015.09.19',
    field2: '后勤部',
    field3: '质量部',
    field4: '岗位调整',
  }
];

var data2 = [
  {
    id: 1,
    field1: '工程师',
    field2: '是',
    field3: '质量部',
    field4: '2013.03.04',
    field5: '36月',
  }
];

var data3 = [
  {
    id: 1,
    field1: '工程师',
    field2: '090302123',
    field3: '质量部',
    field4: '2013.03.04',
    field5: '36月',
  }
];

var data = [];

/**
 * 根据条件查询
 */
function queryByCondition() {
  var param = {};
  $('#table1').bootstrapTable('refreshOptions', {
    queryParams: function (params) {
      var obj = {
        size: params.limit,
        page: params.offset / params.limit + 1,
      };
      $.extend(param, obj);
      return JSON.stringify(param);
    }
  });
};

// 职称证书start
// 操作(职称证书)
function clickOperateTitle(id, row) {
  // 传值给click事件
  return "<a class='qn-check' onclick='viewTitle()'>查看</a>" +
         "<a class='qn-check' onclick='editTitle(`" + id + "`)'>编辑</a>" +
         "<a class='qn-check' onclick='deleteTitle(`" + id + "`)'>删除</a>";
}

// 新增职称证书
function addForm(id){
  $('#addForm_div_'+id).modal('show');
}

// 查看职称证书
function viewTitle(id){
  $('#viewForm_div_2').modal('show');
}

// 编辑职称证书
function editTitle(id){
  $('#editForm_div_2').modal('show');
}

// 删除职称证书
function deleteTitle(id){
  showConfirm("提示","是否确定删除？",function() {
    
  });
}

// 职称证书end

// 资格证书start
// 操作（资格证书）
function clickOperateQualification(id, row) {
  // 传值给click事件
  return "<a class='qn-check' onclick='viewQualification()'>查看</a>" +
         "<a class='qn-check' onclick='editQualification(`" + id + "`)'>编辑</a>" +
         "<a class='qn-check' onclick='deleteQualification(`" + id + "`)'>删除</a>";
}

// 查看资格证书
function viewQualification(id){
  $('#viewForm_div_3').modal('show');
}

// 编辑资格证书
function editQualification(id){
  $('#editForm_div_3').modal('show');
}

// 删除资格证书
function deleteQualification(id){
  showConfirm("提示","是否确定删除？",function() {
    
  });
}
// 资格证书end

// 荣誉证书start
// 操作（荣誉证书）
function clickOperateHonorary(id, row) {
  // 传值给click事件
  return "<a class='qn-check' onclick='viewHonorary()'>查看</a>" +
         "<a class='qn-check' onclick='editHonorary(`" + id + "`)'>编辑</a>" +
         "<a class='qn-check' onclick='deleteHonorary(`" + id + "`)'>删除</a>";
}
// 查看荣誉证书
function viewHonorary(id){
  $('#viewForm_div_4').modal('show');
}

// 编辑荣誉证书
function editHonorary(id){
  $('#editForm_div_4').modal('show');
}

// 删除荣誉证书
function deleteHonorary(id){
  showConfirm("提示","是否确定删除？",function() {
    
  });
}
// 荣誉证书end

// 毕业证书start
function clickOperateGraduation(id, row) {
  // 传值给click事件
  return "<a class='qn-check' onclick='viewGraduation()'>查看</a>" +
         "<a class='qn-check' onclick='editGraduation(`" + id + "`)'>编辑</a>" +
         "<a class='qn-check' onclick='deleteGraduation(`" + id + "`)'>删除</a>";
}
// 查看毕业证书
function viewGraduation(id){
  $('#viewForm_div_5').modal('show');
}

// 编辑毕业证书
function editGraduation(id){
  $('#editForm_div_5').modal('show');
}

// 删除毕业证书
function deleteGraduation(id){
  showConfirm("提示","是否确定删除？",function() {
    
  });
}
// 毕业证书end

/**
 * 表格初始化
 */
function initTable(newParams) {
  var $table = $('#table1');
  $table.bootstrapTable({
    url: "",
    method: 'POST',
    pagination: true,
    pageSize: 10,
    sidePagination: 'server',//设置为服务器端分页
    queryParams: function (params) {
      // 请求参数
      var obj = {
        size: params.limit,
        page: params.offset / params.limit + 1
      };
      return JSON.stringify(obj);
    }
  });
};

$(document).ready(function() {
  var $table1 = $('#table1');
  $table1.bootstrapTable({
    data: data1,
    pagination: true
  });

  var $table2 = $('#table2');
  $table2.bootstrapTable({
    data: data2,
    pagination: true
  });

  var $table3 = $('#table3');
  $table3.bootstrapTable({
    data: data3,
    pagination: true
  });

  var $table4 = $('#table4');
  $table4.bootstrapTable({
    data: data,
    pagination: true
  });

  var $table5 = $('#table5');
  $table5.bootstrapTable({
    data: data,
    pagination: true
  });

  initNavTab(function(index){
    
  });
});
